package com.dycong.common.IO.socket.SSL.ssl;

import org.apache.log4j.Logger;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

/**
 * Created by dycong on 2017/3/28.
 */
public class SocketIOUtil {
    private static Logger log=Logger.getLogger(SocketIOUtil.class);

    public static DataInputStream getInputStream(Socket socket){
        DataInputStream inputStream=null;
        try {
            inputStream=new DataInputStream(socket.getInputStream());
        }catch (IOException e){
            log.error("Socket getInputStream error: "+e);
            throw new RuntimeException(e);
        }
        return inputStream;
    }

    public static DataOutputStream getOutputStream(Socket socket){
        DataOutputStream outputStream=null;
        try {
            outputStream=new DataOutputStream(socket.getOutputStream());
        }catch (IOException e){
            log.error("Socket getOutputStream error: "+e);
            throw new RuntimeException(e);
        }
        return outputStream;
    }
}
